package com.ys.malini.util;

public class PagerContext {
	private static ThreadLocal offset = new ThreadLocal();
	private static ThreadLocal pagesize = new ThreadLocal();
	private static ThreadLocal total = new ThreadLocal();
	public static int MAX_PAGE_SIZE = 10;

	public static int getTotal() {
		Integer os = (Integer) total.get();
		if (os == null) {
			return 0;
		}
		return os;
	}
	
	

	public static void setTotal(int offsetvalue) {
		total.set(offsetvalue);
	}
	
	public static int getOffset() {
		Integer os = (Integer) offset.get();
		if (os == null) {
			return 0;
		}
		return os;
	}
	
	

	public static void setOffset(int offsetvalue) {
		offset.set(offsetvalue);
	}


	public static void removeOffset() {
		offset.remove();
	}

	public static int getPagesize() {
		Integer ps = (Integer) pagesize.get();
		if (ps == null) {
			// 每页显示最大值。如果ps没有设置的话。则显示Integer支持的最大值。
			return Integer.MAX_VALUE;
		}
		return ps;
	}

	public static void setPagesize(int pagesizevalue) {
		pagesize.set(pagesizevalue);
	}

	public static void removePagesize() {
		pagesize.remove();
	}

}
